package basic;

/**
 * @author Cheng Jun
 * Description: 为什么 抽象类不能创建对象，却还有构造函数？构造函数不一定就非要初始化对象，也可以给变量赋值。主要给父类变量赋值。
 * @version 1.0
 * @date 2021/10/26 22:44
 */
public abstract class AbstractFruit {

    private String name;
    private String color;

    public AbstractFruit(String name, String color) {
        this.name = name;
        this.color = color;
        System.out.println("name " + name);
    }

    public static void main(String[] args) {
        Apple apple = new Apple("apple", "red", "world");
    }
}

class Apple extends AbstractFruit {
    private String area;

    public Apple(String name, String color, String area) {
        super(name, color);
        this.area = area;
        System.out.println("area " + area);
    }

    public void Apple() {
    }

    ;
}